import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useRoleInfoStore = defineStore('roleInfo', () => {


  const define = {
    id: null,
    name: null,
    code: null,
    routers: [] as any[]
  }
  const userInfo = ref(define)

  //重置
  const reset = () => {
    userInfo.value = define
  }

  const setUserInfo = (info: any) => {
    userInfo.value = info
  }

  return { userInfo, reset, setUserInfo }
}, {
  persist: {
    key: 'roleInfo',
    storage: localStorage
  }
})
